package Multithreading.Exercise001;

/**
 * ClassName:ThreadDome003
 * Package:Multithreading.Exercise
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/3/5-16:08
 * @Version:v1.0
 */
public class ThreadDome003 {
    /**final void setDaemon(boolean on) 设置为守护线程
     * 细节：
     * 当其他非守护线程执行完毕之后,守护线程会陆续结束
     * */
    public static void main(String[] args) {
        MyThread003_1 t1 = new MyThread003_1();
        MyThread003_2 t2 = new MyThread003_2();
        t1.setName("女神");
        t2.setName("备胎");

        //把第二个线程设置为守护线程(备胎线程)
        t2.setDaemon(true);

        t1.start();
        t2.start();
    }
}
